package JuniTest;
import bean.Competition;
import dao.impl.CompetitionDaoImpl;
import junit.framework.TestCase;
import org.junit.Test;
import java.util.ArrayList;

/**
 * @Author leiHua
 * @Date 2022/6/13 23:47
 */
public class CompetitionDaoTest extends TestCase {

    CompetitionDaoImpl competitionDao = new CompetitionDaoImpl();


    @Test
    public void testSelectAll(){
        ArrayList<Competition> arrayList = competitionDao.selectAll();
        for (Competition competition1 : arrayList) {
            System.out.println(competition1.toString());
        }
    }
    @Test
    public void testadd(){
        Competition competition=new Competition("100","juni测试","操场",20,"2022-7-5");
        boolean add = competitionDao.add(competition);
        assertTrue(add);
    }
    @Test
    public void testSelect(){
        Competition select = competitionDao.select("1");
        System.out.println(select.toString());
    }
    @Test
    public void testUpdate(){
        Competition select = competitionDao.select("1");
        select.setCompetitionName("修改名字");
        boolean update = competitionDao.update(select);
        assertTrue(update);
    }
    @Test
    public void testDelete(){

        boolean delete = competitionDao.delete("100");
        assertTrue(delete);

    }
}
